#include <string>
#include <thread>
#include <mutex>

#include <arpa/inet.h>

#ifndef SERVERCLIENT_H
#define SERVERCLIENT_H

class ServerClient {

public :
	ServerClient( int fd , const struct sockaddr_in &addr ) ;
	~ServerClient() ;
	void exitConnect() ;
	void runCommand(const char *command) ;
	int getFd() ;
	struct sockaddr_in getDetail() ;
	static void task(int socfd, char *command, bool &isConnect, std::mutex &delay);

private :
	struct sockaddr_in addr_ ;
	int fd_ = -1 ; 
	bool isConnect = false ;
	char command_[BUFSIZ + 4] ;

	std::thread *taskT = nullptr ;
	std::mutex delay ;

} ;

#endif
